import React ,{Component} from "react";
import axios from "axios";
import "../utils/swiper-3.3.1.min.js"


export default class Swiper2 extends Component{

    render(){
        var items ;
        if(this.props.children){
           items =  this.props.children.map((child,idx)=>{
                return (
                    <div className="swiper-slide" key={idx}>
                        {child}
                    </div>
                )
            })
        }
        return (
            <div className="swiper-container" ref="swipe" id="swipe">
                <div className="swiper-wrapper">
                    {items}
                </div>
            </div>
        )
    }

    componentDidUpdate(){
        this.refs.swipe = new Swiper("#swipe",this.props.swiperOptions);
    }
}

Swiper2.propTypes = {
    swiperOptions:React.PropTypes.object.isRequired
}

